
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main_list.xhtml">

	<ui:param name="resultList" value="#{licitacaoListMB.resultList}"/>
 	<ui:param name="tituloLista" value="#{messages['licitacao.list.table.title']}"/>

	<ui:define name="botoes">
		<p:commandButton title="#{messages['button.new']}" icon="ui-icon-document" action="#{licitacaoListMB.getNextView}"
						actionListener="#{licitacaoListMB.clear}" ajax="false" />

					<p:commandButton title="#{messages['button.delete']}" icon="ui-icon-trash" onclick="confirmation.show()"
						type="button" immediate="true" ajax="false" />

					<p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode"
						header="#{messages['label.dialog.alert']}!" severity="alert" widgetVar="confirmation">

						<h:commandButton value="#{messages['button.dialog.yes']}" action="#{licitacaoListMB.deleteSelection}"
							actionListener="#{licitacaoListMB.clear}" />
						<h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" />
					</p:confirmDialog>
	</ui:define>
	<ui:define name="filtro">
		<p:fieldset legend="#{messages['filtrar.licitacao']}" toggleable="true" toggleSpeed="500">
				<h:panelGrid columns="2">
					<h:outputLabel value="#{messages['licitacao.label.unidadeOrcamentaria']}: " for="unidadeOrcamentaria" styleClass="text-input" />
					<h:panelGrid columns="5">
						<h:selectOneMenu value="#{licitacaoListMB.unidadeOrcamentaria}" id="unidadeOrcamentaria" style="width: 350px;"
							title="#{messages['licitacao.label.unidadeOrcamentaria']}" 
							requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}">
							<f:selectItem itemLabel="Selecione" itemValue="" />	
	 						<f:selectItems value="#{licitacaoListMB.unidadeOrcamentarias}"></f:selectItems>
						</h:selectOneMenu>
					    <p:message for="unidadeOrcamentaria" />

				    	<h:outputLabel value="#{messages['licitacao.label.numeroLicitacao']}: " for="numeroLicitacao" styleClass="text-input" /> 
				    	<h:inputText id="numeroLicitacao" value="#{licitacaoListMB.numeroLicitacao}" title="#{messages['licitacao.alt.numeroLicitacao']}" size="4" maxlength="4" />
				    	<p:message for="numeroLicitacao" />

					</h:panelGrid>
				</h:panelGrid>

			    <h:commandButton value="#{messages['button.pesquisar']}"  action="#" ajax="true" >
		    		<f:ajax execute="list" render="list" />
		    	</h:commandButton>

			</p:fieldset>		
	</ui:define>
	
		
	<ui:define name="colunaMarcacao">
			<p:column style="width:1%;">
				<h:selectBooleanCheckbox value="#{licitacaoListMB.selection[bean.id]}"></h:selectBooleanCheckbox>
			</p:column>
	</ui:define>
	
		<ui:define name="colunas">
				
				<p:column style="width:5%;" sortBy="#{bean.id}">
					<f:facet name="header">#{messages['licitacao.label.id']}</f:facet>
					<h:outputText value="#{bean.id}" />
				</p:column>
						
				<p:column sortBy="#{bean.numeroLicitacao}">
					<f:facet name="header">#{messages['licitacao.label.numeroLicitacao']}</f:facet>
					<h:commandLink action="#{licitacaoListMB.getNextView}" actionListener="#{licitacaoListMB.clear}">
						<h:outputText value="#{bean.numeroLicitacao}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>

				<p:column sortBy="#{bean.obra.unidadeOrcamentaria.descricao}">
					<f:facet name="header">#{messages['licitacao.label.unidadeOrcamentaria']}</f:facet>
					<h:commandLink action="#{licitacaoListMB.getNextView}" actionListener="#{licitacaoListMB.clear}">
						<h:outputText value="#{bean.obra.unidadeOrcamentaria.descricao}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>

				<p:column sortBy="#{bean.obra.titulo}">
					<f:facet name="header">#{messages['licitacao.label.obra']}</f:facet>
					<h:commandLink action="#{licitacaoListMB.getNextView}" actionListener="#{licitacaoListMB.clear}">
						<h:outputText value="#{bean.obra.titulo}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>

				<p:column sortBy="#{bean.tipoLicitacao.descricao}">
					<f:facet name="header">#{messages['licitacao.label.tipoLicitacao']}</f:facet>
					<h:commandLink action="#{licitacaoListMB.getNextView}" actionListener="#{licitacaoListMB.clear}">
						<h:outputText value="#{bean.tipoLicitacao.descricao}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
				<p:column sortBy="#{bean.situacao.descricao}">
					<f:facet name="header">#{messages['licitacao.label.situacao']}</f:facet>
					<h:commandLink action="#{licitacaoListMB.getNextView}" actionListener="#{licitacaoListMB.clear}">
						<h:outputText value="#{bean.situacao.descricao}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
	</ui:define>
</ui:composition>